<template>
  <div class="box">
    <el-row class="box_content">
      <el-col :span="4">
        <el-table border :data="tableData" style="width: 100%">
          <el-table-column prop="qlr" label="权利人" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button size="mini" @click="btn_see(scope.row.landReclaimAgencyAgreementFile)">查看</el-button>
            </template>
          </el-table-column>
        </el-table>
      </el-col>
      <el-col :span="20" class="file" v-show="showFlie">
        <span v-show="loadIfram==1" class="iframeLoad">
          加载中
          <div class="el-icon-loading"></div>
        </span>
        <iframe
          frameborder="0"
          v-show="loadIfram==2"
          id="wode"
          name="showHere"
          scrolling="auto"
          width="100%"
          height="100%"
          :src="path"
        ></iframe>
      </el-col>
    </el-row>
  </div>
</template>

<script>
import { queryAllByProjectId } from "@/api/fkEntrust";
export default {
  data() {
    return {
      tableData: [],
      showFlie: false,
      loadIfram: 1,
      path: ""
    };
  },
  mounted() {
    this.getData();
  },
  methods: {
    getData() {
      var data = {
        projectId: localStorage.getItem("projectId")
      };
      queryAllByProjectId(data).then(res => {
        this.tableData = res.data;
      });
    },
    btn_see(path) {
      let that=this
      that.showFlie = true;
      that.path = that.$https + path.filePath;
      var iframe = document.getElementById("wode");
      iframe.onload = function() {
        console.log("加载完成");
        that.loadIfram = 2;
      };
    }
  }
};
</script>

<style lang="scss" scoped>
* {
  box-sizing: border-box;
}
.box {
  padding: 30px;
}
.file {
  padding-left: 20px;
  height: calc(100vh - 200px);
}
.iframeLoad {
  display: flex;
  font-size: 35px;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
}
</style>